#include <bits/stdc++.h>
using namespace std;
const int N=1e5+50;
const int M=1e7+50;
int a[N];
int n;
struct Edge{
    int v,next;
}edge[M];
int cnt,head[N];
void init(){
    cnt=0;
    memset(head,-1,sizeof(head));
}
void add(int u,int v){
    edge[cnt]=Edge{v,head[u]};
    head[u]=cnt++;
}
bool vis[N];
//出度 出度为0即为必败态
int deg[N];
int w[N];
int main(void){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    init();
    //建反图
    for(int i=1;i<=n;i++){
        for(int j=i+a[i];j<=n;j+=a[i]){
            if(a[j]>a[i]){
                add(j,i);
                deg[i]++;
            }
        }
        for(int j=i-a[i];j>=1;j-=a[i]){
            if(a[j]>a[i]){
                add(j,i);
                deg[i]++;
            }
        }
    }
    memset(w,-1,sizeof(w));
    queue<int> q;
    for(int i=1;i<=n;i++){
        if(!deg[i]){
            //压入必败态
            q.push(i);
            w[i]=0;
        }
    }
    while(!q.empty()){
        int u=q.front();
        q.pop();
        for(int i=head[u];i!=-1;i=edge[i].next){
            int v=edge[i].v;
            //未定态,即贪心定态
            if(w[v]==-1){
                if(w[u]==0){
                    w[v]=1;
                }else{
                    w[v]=0;
                }
            }else{
                //已定态,但只要有一个后继态是必败,那即是必胜态
                if(w[u]==0){
                    w[v]=1;
                }
            }
            deg[v]--;
            if(deg[v]==0){
                q.push(v);
            }
        }
    }
    for(int i=1;i<=n;i++){
        if(w[i]){
            printf("A");
        }else{
            printf("B");
        }
    }
    printf("\n");
    return 0;
}